﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ListView.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Scrollbars.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Buttons.xaml" />

        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.CheckBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ComboBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ContextMenu.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ListBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.PasswordBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.ProgressBar.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.RadioButton.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Slider.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TabControl.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBlock.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBox.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Tooltip.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <ControlTemplate x:Key="ValidationToolTipTemplate">
        <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
            <Grid.RenderTransform>
                <TranslateTransform x:Name="xform" X="-25" />
            </Grid.RenderTransform>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="OpenStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0" />
                        <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
                                    <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root">
                                    <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualTransition>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Closed">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root">
                                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Open">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
                                <SplineDoubleKeyFrame KeyTime="0" Value="0" />
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root">
                                <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border Background="{DynamicResource ValidationBrush1}" CornerRadius="5" Margin="4,4,-4,-4" />
            <Border Background="{DynamicResource ValidationBrush2}" CornerRadius="4" Margin="3,3,-3,-3" />
            <Border Background="{DynamicResource ValidationBrush3}" CornerRadius="3" Margin="2,2,-2,-2" />
            <Border Background="{DynamicResource ValidationBrush4}" CornerRadius="2" Margin="1,1,-1,-1" />
            <Border Background="{DynamicResource ValidationBrush5}" CornerRadius="2" /> 
            <Border CornerRadius="2">
                <TextBlock Foreground="{DynamicResource WhiteColorBrush}"
                           MaxWidth="250"
                           Margin="8,4,8,4"
                           TextWrapping="Wrap"
                           Text="{Binding (Validation.Errors)[0].ErrorContent}"
                           UseLayoutRounding="false" />
            </Border>
        </Grid>
    </ControlTemplate>

    <Style TargetType="ToolTip" BasedOn="{StaticResource MetroToolTip}" />
    <Style TargetType="Button" BasedOn="{StaticResource MetroButton}" />
    <Style TargetType="ToggleButton" BasedOn="{StaticResource MetroToggleButton}" />
    <Style TargetType="TextBox" BasedOn="{StaticResource MetroTextBox}" />
    <Style TargetType="Slider" BasedOn="{StaticResource MetroSlider}" />
    <Style TargetType="TextBlock" BasedOn="{StaticResource MetroTextBlock}" />
    <Style TargetType="TabItem" BasedOn="{StaticResource MetroTabItem}"  />
    <Style TargetType="TabControl" BasedOn="{StaticResource MetroTabControl}" />
    <Style TargetType="ScrollBar" BasedOn="{StaticResource MetroScrollBar}" />
    <Style TargetType="RadioButton" BasedOn="{StaticResource MetroRadioButton}" />
    <Style TargetType="ProgressBar" BasedOn="{StaticResource MetroProgressBar}" />
    <Style TargetType="PasswordBox" BasedOn="{StaticResource MetroPasswordBox}" />
    <Style TargetType="CheckBox" BasedOn="{StaticResource MetroCheckBox}" />
    <Style TargetType="ComboBox" BasedOn="{StaticResource MetroComboBox}" />
    <Style TargetType="ComboBoxItem" BasedOn="{StaticResource MetroComboBoxItem}" />
    <Style TargetType="Separator" BasedOn="{StaticResource MetroSeparator}" />
    <Style TargetType="MenuItem" BasedOn="{StaticResource MetroMenuItem}" />
    <Style TargetType="ContextMenu" BasedOn="{StaticResource MetroContextMenu}" />
</ResourceDictionary>